import request from '@/config/axios'

// 用户参与活动 VO
export interface ActivityUserVO {
  id: number // 主键
  activityId: number // 活动id
  userId: number // 用户id
  carNumber: string // 车牌号
  activityMoney: number // 首次参与活动付出金额
  pickUpTime: Date // 取货时间
  pickUpDesc: string // 取货描述
  userSign: string // 取货签名
  type: number // 消费类型 1消费 2退货
  useMoney: number // 消费、退货金额
}

// 用户参与活动 API
export const ActivityUserApi = {
  // 查询用户参与活动分页
  getActivityUserPage: async (params: any) => {
    return await request.get({ url: `/erp/activity-user/page`, params })
  },

  // 查询用户参与活动详情
  getActivityUser: async (params: any) => {
    return await request.get({ url: `/erp/activity-user/get`, params })
  },

  getActivityUserJoinInfo: async (id: number) => {
    return await request.get({ url: `/erp/activity-user/get-join-info?id=` + id })
  },

  // 新增用户参与活动
  createActivityUser: async (data: ActivityUserVO) => {
    return await request.post({ url: `/erp/activity-user/create`, data })
  },

  // 修改用户参与活动
  updateActivityUser: async (data: ActivityUserVO) => {
    return await request.put({ url: `/erp/activity-user/update`, data })
  },

  // 删除用户参与活动
  deleteActivityUser: async (id: number) => {
    return await request.delete({ url: `/erp/activity-user/delete?id=` + id })
  },

  // 导出用户参与活动 Excel
  exportActivityUser: async (params) => {
    return await request.download({ url: `/erp/activity-user/export-excel`, params })
  },
}
